// pages/recommendSongs/recommendSongs.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        day:"01",
        month:"04",
        songs:[],
        cookie:wx.getStorageSync('cookie')
    },
    // 获取每日推荐歌曲
    async getRecommendSongs(){
        const res = await wx.p.request({
            url:`${wx.root}/recommend/songs`,
            data:{
                cookie:wx.getStorageSync('cookie')
            }
        })
        this.setData({
            songs:res.data.data.dailySongs
        })
    },
        // 去登录
    goLogin(){
            wx.switchTab({
              url: '/pages/myInfo/myInfo',
            })
        },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        const date = (new Date()).getDate()
        const mon = (new Date()).getMonth()+1
        this.setData({
            day:date>=10?date:'0'+date,
            month:mon>=10?mon:'0'+mon
        })
        this.getRecommendSongs()
    },

})